
var webpack = require('webpack');
module.exports = {
	entry: {
		app: './static/src/app.js'
		// , vendor: ['jquery']
	},
	output: {
		path: __dirname,
		filename: './static/dist/js/app.build.js'
	},
	module: {
	  loaders: [
	  	//ES6 => ES5 
	    {
      	test: /\.js$/,
      	exclude: /(node_modules|bower_components)/,
      	loader: 'babel',
      	query: {
        	presets: [ 'es2015' ]
      	},
	    },
	    //图片加载
	    { test: /\.(jpe?g|png|gif|svg)$/i, loader: 'url?limit=8192!img?progressive=true' },
	    //LESS加载
	    { test: /\.less$/, loader: 'style!css!less' },
    	//HTML 文件加载
    	{ test: /\.html$/, loader: "html" },
    	//Vue 文件加载
    	{ test: /\.vue$/, loader: "vue" }
	  ]
	},
	plugins: [
	 	//使用UglifyJs压缩代码
   	new webpack.optimize.UglifyJsPlugin({
			// beautify: true, //美化代码
			compress: {
      	warnings: false	//去掉编译中的警告
	   	},
			comments: false //去除所有注释，包括license等
   	}),
   	// new webpack.optimize.CommonsChunkPlugin('vendor', './public/js/lib.build.js') //单独生成 引用库
	]
}

/*

babel: 转换 es6 到 es5

webpack: webpack --watch

*/
